package com.ruoyi.develop.process.processPayApply.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.develop.process.processPayApply.domain.ProcessPayApply;
import com.ruoyi.develop.process.processPayApply.service.IProcessPayApplyService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 付款申请单操作记录Controller
 * @author lmm
 * @date 2025-07-14
 */
@RestController
@RequestMapping("/processPayApply/processPayApply")
public class ProcessPayApplyController extends BaseController {
    @Autowired
    private IProcessPayApplyService processPayApplyService;

    /**
     * 查询付款申请单操作记录列表
     */
    @GetMapping("/list")
    public TableDataInfo list(ProcessPayApply entity) {
        startPage();
        List<ProcessPayApply> list = processPayApplyService.selectList(entity);
        return getDataTable(list);
    }

    /**
     * 导出付款申请单操作记录列表
     */
    @Log(title = "付款申请单操作记录", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ProcessPayApply entity) {
        List<ProcessPayApply> list = processPayApplyService.selectList(entity);
        ExcelUtil<ProcessPayApply> util = new ExcelUtil<ProcessPayApply>(ProcessPayApply. class);
        util.exportExcel(response, list, "付款申请单操作记录数据");
    }

    /**
     * 获取付款申请单操作记录详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id) {
        return AjaxResult.success(processPayApplyService.selectById(id));
    }

    /**
     * 新增付款申请单操作记录
     */
    @Log(title = "付款申请单操作记录", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    public AjaxResult add(@RequestBody ProcessPayApply entity) {
        return toAjax(processPayApplyService.insert(entity));
    }

    /**
     * 修改付款申请单操作记录
     */
    @Log(title = "付款申请单操作记录", businessType = BusinessType.UPDATE)
    @PutMapping("/edit")
    public AjaxResult edit(@RequestBody ProcessPayApply entity) {
        return toAjax(processPayApplyService.update(entity));
    }

    /**
     * 删除付款申请单操作记录
     */
    @Log(title = "付款申请单操作记录", businessType = BusinessType.DELETE)
    @DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids) {
        return toAjax(processPayApplyService.deleteByIds(ids));
    }
}
